// 导入二次封装axios
import koi from "@/utils/axios.ts";

// 统一管理接口
enum API {
  gl_role = "/role",
  gl_api = "/api",
}

// 获取所有角色
export const getAllRole = (params: any) => {
  return koi.get(API.gl_role + '/list', params);
};

// 角色导出
export const exportRole = (data: { roleIds: any[] }) => {
  return koi.post(API.gl_role + '/export', {
    roleIds: data.roleIds
  }, {
    responseType: "blob"
  });
};

// 角色导入
export const importRole = (data: any) => {
  return koi.post(API.gl_role + '/import', data);
};

// 删除角色
export const deleteRole = (roleId: any) => {
  return koi.delete(API.gl_role + '/' + roleId);
};

// 获取角色
export const getRole = (roleId: any) => {
  return koi.get(API.gl_role + '/' + roleId);
};

// 获取角色的服务角色标识的模型
export const getRoleService = (roleId: any) => {
  return koi.get(API.gl_role + '/' + roleId + '/tags');
};

// 获取所有api
export const getAllApi = () => {
  return koi.get(API.gl_api + '/list');
};